<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>  
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>会员管理</title>
		<link rel="stylesheet" href="<%=basePath %>css/style.default.css" type="text/css" />
		<script type="text/javascript" src="<%=basePath %>js/plugins/jquery-1.7.min.js"></script>
		<script type="text/javascript" src="<%=basePath %>js/plugins/jquery-form.js"></script>
	</head>

	<body class="withvernav">
		<div class="bodywrapper">
			<div class="topheader">
				<div class="left">
					<h1 class="logo">趣味<span>国学</span></h1>
					<br clear="all" />

				</div>
				<!--left-->
				<div class="right">
					<div class="userinfo">
						<img src="<%=basePath %>images/thumbs/avatar.png" alt="" />
						<span>管理员</span>
						<a class="fa fa-power-off transition3" title="退出" href="<%=basePath %>back/logout.do"></a>
					</div>
					<!--userinfo-->
				</div>
				<!--right-->
			</div>
			<!--topheader-->
			<div class="vernav2 iconmenu">
				<ul>
					<li class="current">
						<a href="#formsub" class="editor"><i class="fa fa-flag-checkered"></i>数据配置</a>
						<span class="arrow"></span>
			            	<ul id="formsub" style="display: none;">
						<li>
							<a href="<%=basePath %>View/levelConfig/level.do" class="elements"><i class="fa fa-trophy"></i>闯关配置</a>
						</li>
						<li>
							<a href="<%=basePath %>View/propConfig/prop.do" class="elements"><i class="fa fa-trophy"></i>道具配置</a>
						</li>
						<li>
							<a href="<%=basePath %>View/bookConfig/book.do" class="widgets"><i class="fa fa-book"></i>典籍配置</a>
						</li>
						<li>
							<a href="<%=basePath %>View/planConfig/plan.do" class="calendar"><i class="fa fa-spinner"></i>计划配置</a>
						</li>
						<li>
							<a href="<%=basePath %>View/planChapterConfig/planChapter.do" class="typo"><i class="fa fa-pie-chart"></i>计划章节配置</a>
						</li>
						<li>
							<a href="<%=basePath %>View/tapesConfig/tapes.do" class="support"><i class="fa fa-microphone"></i>录音进度配置</a>
						</li>
						<li>
							<a href="<%=basePath %>View/regionConfig/region.do" class="typo"><i class="fa fa-pie-chart"></i>区域配置</a>
						</li>
						<li>
							<a href="<%=basePath %>View/meanConfig/mean.do" class="tables"><i class="fa fa-file-powerpoint-o"></i>释义配置</a>
						</li>
						<li>
							<a href="<%=basePath %>View/chapterConfig/chapter.do" class="buttons"><i class="fa fa-file-text"></i>章节目录配置</a>
						</li>
						<li>
							<a href="<%=basePath %>View/masterConfig/master.do" class="error"><i class="fa fa-volume-down"></i>专家吟诵</a>
						</li>
						<li>
							<a href="<%=basePath %>View/storyConfig/story.do" class="widgets"><i class="fa fa-book"></i>故事配置</a>
						</li>
						<li>
							<a href="<%=basePath %>View/shopConfig/shopConfig.do" class="error"><i class="fa fa-share"></i>商城配置</a>
						</li>
						<li>
							<a href="<%=basePath %>View/coinsConfig/coinsConfig.do" class="error"><i class="fa fa-share"></i>充值配置</a>
						</li>
						<li>
							<a href="<%=basePath %>View/advertisementConfig/advertisementConfig.do" class="error"><i class="fa fa-share"></i>广告配置</a>
						</li>
			            </ul>
			            </li>
						<li>
							<a href="<%=basePath %>View/materialConfig/material.do" class="error"><i class="fa fa-file-image-o"></i>素材管理</a>
						</li>
						<li>
							<a href="<%=basePath %>View/memberConfig/member.do" class="error"><i class="fa fa-group"></i>会员管理</a>
						</li>
						<li>
							<a href="<%=basePath %>View/publishLogs/publish.do" class="error"><i class="fa fa-share"></i>版本发布</a>
						</li>
						<li>
							<a href="<%=basePath %>View/reportTapes/report.do" class="error"><i class="fa fa-share"></i>作品举报</a>
						</li>
						<li>
							<a href="<%=basePath %>View/feedback/feedback.do" class="error"><i class="fa fa-share"></i>意见反馈</a>
						</li>
						<li>
							<a href="<%=basePath %>View/push/push.do" class="error"><i class="fa fa-share"></i>推送消息</a>
						</li>
				</ul>
				<a class="togglemenu"></a>
				<br /><br />
			</div>
			<!--leftmenu-->
			<div class="centercontent">
				<div class="add floatClear">
					<div class="contenttitle2 floatLeft">
						<h3>会员管理</h3>
					</div>
				</div>
				<!--contenttitle-->
				<table cellpadding="0" cellspacing="0" border="0" class="stdtable" id="dyntable">
					<thead>
						<tr>
							<th class="head0">会员ID</th>
							<th class="head1">设备ID</th>
							<th class="head0">昵称</th>
							<th class="head1">性别</th>
							<th class="head0">微信ID</th>
							<th class="head1">新浪ID</th>
							<th class="head0">腾讯ID</th>
							<th class="head1">绑定手机号</th>
							<th class="head0">账号状态</th>
							<th class="head1">注册时间</th>
							<th class="head0">操作</th>
						</tr>
					</thead>
					<tfoot>
						<tr>
							<th class="head0">会员ID</th>
							<th class="head1">设备ID</th>
							<th class="head0">昵称</th>
							<th class="head1">性别</th>
							<th class="head0">微信ID</th>
							<th class="head1">新浪ID</th>
							<th class="head0">腾讯ID</th>
							<th class="head1">绑定手机号</th>
							<th class="head0">账号状态</th>
							<th class="head1">注册时间</th>
							<th class="head0">操作</th>
						</tr>
					</tfoot>
					<tbody>
					<c:forEach items="${data}" var="member">
						<tr class="gradeX">
							<td id="id">${member.id}</td>
							<td id="identityId">
							<c:choose>
      						<c:when test="${empty member.identityId}">暂未绑定</c:when>
      						<c:otherwise>${member.identityId}</c:otherwise>
							</c:choose>
							</td>
							<td id="nickName">
							<c:choose>
      						<c:when test="${empty member.nickName}">未绑定昵称</c:when>
      						<c:otherwise>${member.nickName}</c:otherwise>
							</c:choose>
							</td>
							<td id="sex">
							<c:choose>
      						<c:when test="${member.sex=='1'}">男</c:when>
      						<c:when test="${member.sex=='2'}">女</c:when>
							</c:choose>
							</td>
							<td id="wechatAccount">
							<c:choose>
      						<c:when test="${empty member.wechatAccount}">暂未绑定</c:when>
      						<c:otherwise>${member.wechatAccount}</c:otherwise>
							</c:choose>
							</td>
							<td id="sinaAccount">
							<c:choose>
      						<c:when test="${empty member.sinaAccount}">暂未绑定</c:when>
      						<c:otherwise>${member.sinaAccount}</c:otherwise>
							</c:choose>
							</td>
							<td id="qqAccount">
							<c:choose>
      						<c:when test="${empty member.qqAccount}">暂未绑定</c:when>
      						<c:otherwise>${member.qqAccount}</c:otherwise>
							</c:choose>
							</td>
							<td id="userTel">
							<c:choose>
      						<c:when test="${empty member.userTel}">暂未绑定</c:when>
      						<c:otherwise>${member.userTel}</c:otherwise>
							</c:choose>
							</td>
							<td id="status">
							<c:choose>
      						<c:when test="${member.status=='1'}">正常</c:when>
      						<c:when test="${member.status=='2'}">游客账号</c:when>
      						<c:when test="${member.status=='3'}">异常账号</c:when>
      						<c:otherwise>未知错误</c:otherwise>
							</c:choose>
							</td>
							<td id="createdAt">${member.createdAt}</td>
							<td class="operate">
							<a class="fa fa-search"  title="查看"></a>
							<a class="fa fa-warning" title="封号" id="${member.id}"></a>
							<a class="fa fa-check-square-o" title="解封" data="${member.id}"></a>
							</td>
						</tr>
					</c:forEach>
					</tbody>
				</table>
				
				<br /><br />
				<br clear="all" />

			</div>
			<!-- centercontent -->

		</div>
		<!--bodywrapper-->
		
		<div class="alertBox positionF">
			<form class="positionF" id="editTr">
				<div class="textRight"><i class="fa fa-close closeAlert"></i></div>
				<div id="inputBox">
					<!--<label><span class="title">名称</span><input type="text" /></label>-->
				</div>
			</form>
			<div class="shadown positionF"></div>
		</div>
		
	</body>
	<script type="text/javascript">
					$("#save").click(function(){
						var options = {
								target:'#editTr',
				                url: '<%=basePath%>Config/member.do',
				                type: 'POST',
				                dataType: 'json',
				                success: function (result) {
				                    if (result.code=="200") {
										alert(result.message);
										window.location.reload();
				                    }
				                    else {
				                    	alert(result.message);
				                    }
				                },
				                iframe: false
				            };
				            $("#editTr").ajaxSubmit(options);
				            return false;
					});
					
				$('.fa-warning').click(function(){
						var id =jQuery(this).attr("id");
						jConfirm('是否封禁当前账号？', '封号操作', function(r) {
						if(r){
							 $.ajax({
								 url:'<%=basePath%>User/del/member.do',
								 data:{'id':id},
								 dataType:'JSON',
								 type:'POST',
								 success:function(data){
									 if (data.code=='200'){
										 alert(data.message);
										 window.location.reload();
									 } else {
										 alert(data.message);
									 }
								 },
								 error:function(){
									 alert("操作失败，请稍后再试");
								 }
							 })
						}else{
							
						}
					});
					return false;
				});
				$('.fa-check-square-o').click(function(){
					var id =jQuery(this).attr("data");
					jConfirm('是否解封当前账号？', '解封操作', function(r) {
					if(r){
						 $.ajax({
							 url:'<%=basePath%>User/unblock/member.do',
							 data:{'id':id},
							 dataType:'JSON',
							 type:'POST',
							 success:function(data){
								 if (data.code=='200'){
									 alert(data.message);
									 window.location.reload();
								 } else {
									 alert(data.message);
								 }
							 },
							 error:function(){
								 alert("操作失败，请稍后再试");
							 }
						 })
					}else{
						
					}
				});
				return false;
			});
				jQuery('.operate .fa-search').click(function(){
					$('#inputBox').empty();
						$('.alertBox').fadeToggle(300);
						jQuery(this).parents('tr').find('td').not('.operate').each(function(){
							var thisval = jQuery(this).text();
							var thisName = jQuery(this).attr("id");
							var thText = $(this).parents('.stdtable').find('th').eq($(this).index()).text();
						$('#inputBox').append('<label><span class="title">'+thText+':</span><input disabled="true" readOnly="true" type="text" name="'+thisName+'" value='+thisval+'></label>')
					})
				})
		</script>
		<script type="text/javascript" src="<%=basePath %>js/plugins/jquery-1.7.min.js"></script>
		<script type="text/javascript" src="<%=basePath %>js/plugins/jquery-ui-1.8.16.custom.min.js"></script>
		<script type="text/javascript" src="<%=basePath %>js/plugins/jquery.cookie.js"></script>
		<script type="text/javascript" src="<%=basePath %>js/plugins/jquery.dataTables.min.js"></script>
		<script type="text/javascript" src="<%=basePath %>js/plugins/jquery.uniform.min.js"></script>
		<script type="text/javascript" src="<%=basePath %>js/custom/general.js"></script>
		<script type="text/javascript" src="<%=basePath %>js/custom/tables.js"></script>
		
		<!--弹出框js-->
		<script type="text/javascript" src="<%=basePath %>js/plugins/colorpicker.js"></script>
		<script type="text/javascript" src="<%=basePath %>js/plugins/jquery.alerts.js"></script>
		<script type="text/javascript" src="<%=basePath %>js/custom/elements.js"></script>
		<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="js/plugins/excanvas.min.js"></script><![endif]-->
		<!--[if IE 9]>
    <link rel="stylesheet" media="screen" href="css/style.ie9.css"/>
<![endif]-->
		<!--[if IE 8]>
    <link rel="stylesheet" media="screen" href="css/style.ie8.css"/>
<![endif]-->
		<!--[if lt IE 9]>
	<script src="js/plugins/css3-mediaqueries.js"></script>
<![endif]-->
</html>